<%-- 
    Document   : index
    Created on : Apr 21, 2012, 7:01:58 PM
    Author     : TANGQUOCTUAN
--%>

<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<link href="JQuery/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="JQuery/jquery.min.js"></script>
<script src="JQuery/jquery-ui.min.js"></script>
<script src="JQuery/jquery-ui-timepicker-addon.css"></script>
<script src="JQuery/jquery-ui-timepicker-addon.js"></script>
<%@taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tunga Restaurant</title>
        <link href="style.css" rel="stylesheet" type="text/css" />
    </head>
    <script>
        $(function() {
            $( "#datepicker" ).datetimepicker();
        });
    </script>
    <script>
        function addDate(){
            date = new Date();
            var month = date.getMonth()+1;
            var day = date.getDate();
            var year = date.getFullYear();

            var currentTime = new Date()
            var hours = currentTime.getHours()
            var minutes = currentTime.getMinutes()
            if (minutes < 10)
                minutes = "0" + minutes

            if (document.getElementById('current').value == ''){
                document.getElementById('current').value = ((''+month).length<2 ? '0' : '') + month +  '/' + ((''+day).length<2 ? '0' : '') + day + '/' + year + " " + hours + ":" + minutes;
            }
        }
    </script>
    <script type="text/javascript">
        function check(){
            var seat = document.getElementById("seat");
            var start = document.getElementById("datepicker");
            var resphone=/^[\d]{1,}$/;
            var current = document.getElementById("current");

            var thetime=new Date();
            var date = thetime.getMonth() + "/" + thetime.getDay() + "/" + thetime.getYear();

            if(seat.value.length==0){
                alert("This field is required");
                f.txtseat.focus();
                return false;
            }

            if(resphone.test(seat.value)==false){
                alert("Seat must be numberic");
                f.txtseat.focus();
                return false;
            }

            if(seat.value==0){
                alert("Capacity must be bigger than 0");
                f.txtseat.focus();
                return false;
            }

            if(start.value.length==0){
                alert("Choose Start day");
                return false;
            }

            if(start.value<=current.value){
                alert("Choose wrong or time in start day");
                return false;
            } 
            return true;
        }
    </script>
    <body onload="addDate();">
        <center>
            <c:set var="session" value="${sessionScope.user}"/>
            <div class="outer">
                <!--Header end-->
                <div id="rc1"></div>
                <div id="bg">
                    <div class="toplinks"><a href="ContactUs.jsp">Contact us</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="initShowFood?action=Food">Food</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="ControllerTables?action=Table">Table</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="ControllerRooms?action=Room">Room</a></div><div class="sap">|</div>
                    <c:if test="${empty session}">
                        <div class="toplinks"><a href="registration.jsp">Register</a></div><div class="sap">|</div>
                        <div class="toplinks"><a href="login.jsp">Login</a></div><div class="sap">|</div>
                    </c:if>
                    <div class="toplinks"><a href="index.jsp">Home Page</a></div>
                    <div><font color="white">Welcome, </font><font color="yellow">${sessionScope.user}</font> </div>
                    <div>
                        <font color="yellow"><a href="ControllerCustomer?action=Information&user=${sessionScope.user}">Your information</a></font>
                        <%
                                    if (session.getAttribute("isadmin") != null) {
                        %>
                        <a href="index_admin.jsp">Admin Manager</a>
                        <%                                    }
                        %>
                        <font color="yellow">
                            <c:url var="LogOut" value="ControllerCustomer">
                                <c:param name="action" value="LogOut"/>
                            </c:url>
                            <a href="${LogOut}">LogOut</a>
                        </font>
                    </div>
                </div>
                <div id="rc2"></div>
                <div id="header">
                    <div class="name">Tunga Restaurant</div>
                    <div class="tag">The best restaurant in the world</div>
                </div>
                <!--Top nav end-->
                <div style="clear:left"></div>
                <div id="outer2">
                    <div id="left-nav">
                        <div class="leftlinks">
                            <span class="heading">Quick Links</span>
                            <ul>
                                <li><a href="index.jsp">Home Page </a></li>
                                <li><a href="ControllerRooms?action=Room">Room</a></li>
                                <li><a href="ControllerTables?action=Table">Table</a></li>
                                <li><a href="initShowFood?action=Food">Food</a></li>
                                <c:if test="${not empty session}">
                                    <li><a href="ControllerRooms?action=BookRoom">Book Room</a></li>
                                    <li><a href="ControllerTables?action=BookTable">Book Table </a></li>                                    
                                    <li><a href="addToCart.jsp">Shopping Cart</a></li>
                                </c:if>
                                <li><a href="ContactUs.jsp">Contact Us </a></li>
                            </ul>
                        </div>
                    </div><div class="inner_copy"><div class="inner_copy">All <a href="http://www.magentothemesworld.com" title="Best Magento Templates">premium Magento themes</a> at Magentothemesworld.com!</div></div>
                    <div id="content">

                        <span class="heading">Book Table:</span>
                        <div id="main">
                            <form action="ControllerTables" name="f" method="POST" onsubmit="return check();">
                                <c:set var="load" value="${applicationScope.insertbooktable}"/>
                                <c:set var="loadRes" value="${applicationScope.resid}"/>
                                <table border="0" align="center">
                                    <tbody>
                                        <tr>
                                            <td>Customer ID:</td>
                                            <td><input type="" name="txtcustid" value="${sessionScope.user}"readonly /></td>
                                        </tr>
                                        <tr>
                                            <td>Restaurant ID:</td>

                                            <td><select name="txtres">
                                                    <c:forEach var="rs" items="${loadRes}">
                                                        <option value="${rs.resID}">${rs.resName}</option>
                                                    </c:forEach>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>NoSeat :</td>
                                            <td><input type="text" name="txtseat" id="seat"/></td>
                                        </tr>
                                        <tr>
                                            <td>Oder Day:</td>
                                            <td><input type="text" name="txtoder" id="datepicker" readonly/></td>
                                        </tr>

                                        <tr>
                                            <td>ReserveFee :</td>
                                            <td><input type="text" name="txtreserve" value="200" readonly="true" /></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td><input type="submit" value="Book" name="action" /> <input type="reset" value="Reset" /></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form>
                            <input type="hidden" id="current" readonly="true"/>
                        </div>
                    </div>
                    <div style="clear:left"></div>
                </div>
                <!--Bottom part-->
                <div id="bottom">
                    <div id="footer"><div class="fcenter">F5-10-1009-S1</div></div>
                </div>
            </div>
        </center>
    </body>
</html>
